package bairui.international.service.impl;

import bairui.international.model.domain.jpa.TB_User;
import bairui.international.service.Service_User_Generate;
import org.springframework.stereotype.Service;
import bairui.international.dao.jpa.Repository_User;

/**
 *
 */
@Service
public class Service_UserImpl_Generate
	implements Service_User_Generate
{

	
	@org.springframework.beans.factory.annotation.Autowired
	private Repository_User dao;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_ProductOrder service_ProductOrder;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_UserStateRecord service_UserStateRecord;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_ProxyAreaAddress service_ProxyAreaAddress;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_UserGradeRecord service_UserGradeRecord;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_Address service_Address;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_ElectronicTicket service_ElectronicTicket;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_ElectronicTicketPresentRecord service_ElectronicTicketPresentRecord;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_UserAgentRequestOrder service_UserAgentRequestOrder;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_WinPrize service_WinPrize;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_BranchCompanyStaff service_BranchCompanyStaff;



	
	
	
	/**
	 * deleteById
	 */
	public void deleteById(
		@com.sh_lianjing.annotation.ParameterName("id") @lombok.NonNull Long id
	) throws Exception {
		TB_User bean = getDao().findById(id).get();
		// productOrders
		java.util.List<bairui.international.model.domain.jpa.TB_ProductOrder> productOrders = service_ProductOrder.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!productOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ProductOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ProductOrder item : productOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "productOrders", str);
		}
		// userStateRecords
		java.util.List<bairui.international.model.domain.jpa.TB_UserStateRecord> userStateRecords = service_UserStateRecord.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!userStateRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_UserStateRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_UserStateRecord item : userStateRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "userStateRecords", str);
		}
		// proxyAreaAddresss
		java.util.List<bairui.international.model.domain.jpa.TB_ProxyAreaAddress> proxyAreaAddresss = service_ProxyAreaAddress.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!proxyAreaAddresss.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ProxyAreaAddress.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ProxyAreaAddress item : proxyAreaAddresss){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "proxyAreaAddresss", str);
		}
		// userGradeRecords
		java.util.List<bairui.international.model.domain.jpa.TB_UserGradeRecord> userGradeRecords = service_UserGradeRecord.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!userGradeRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_UserGradeRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_UserGradeRecord item : userGradeRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "userGradeRecords", str);
		}
		// addresss
		java.util.List<bairui.international.model.domain.jpa.TB_Address> addresss = service_Address.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!addresss.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_Address.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_Address item : addresss){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "addresss", str);
		}
		// assignedTickets
		java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicket> assignedTickets = service_ElectronicTicket.page(it->it.assignedUser.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!assignedTickets.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ElectronicTicket.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ElectronicTicket item : assignedTickets){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "assignedTickets", str);
		}
		// electronicTicketPresentedRecords
		java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> electronicTicketPresentedRecords = service_ElectronicTicketPresentRecord.page(it->it.presenteder.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!electronicTicketPresentedRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ElectronicTicketPresentRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord item : electronicTicketPresentedRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "electronicTicketPresentedRecords", str);
		}
		// electronicTicketPresentRecords
		java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> electronicTicketPresentRecords = service_ElectronicTicketPresentRecord.page(it->it.presenter.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!electronicTicketPresentRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ElectronicTicketPresentRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord item : electronicTicketPresentRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "electronicTicketPresentRecords", str);
		}
		// takedTickets
		java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicket> takedTickets = service_ElectronicTicket.page(it->it.takor.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!takedTickets.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ElectronicTicket.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ElectronicTicket item : takedTickets){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "takedTickets", str);
		}
		// userAgentRequestOrders
		java.util.List<bairui.international.model.domain.jpa.TB_UserAgentRequestOrder> userAgentRequestOrders = service_UserAgentRequestOrder.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!userAgentRequestOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_UserAgentRequestOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_UserAgentRequestOrder item : userAgentRequestOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "userAgentRequestOrders", str);
		}
		// winPrizes
		java.util.List<bairui.international.model.domain.jpa.TB_WinPrize> winPrizes = service_WinPrize.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!winPrizes.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_WinPrize.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_WinPrize item : winPrizes){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "winPrizes", str);
		}
		// branchCompanyStaffs
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaff> branchCompanyStaffs = service_BranchCompanyStaff.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyStaffs.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaff.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaff item : branchCompanyStaffs){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyStaffs", str);
		}
		// userAmount
		bairui.international.model.domain.jpa.TB_UserAmount userAmount = bean.getUserAmount();
		if(null != userAmount){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_UserAmount.Comment+":[" + userAmount.toString() + "])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "userAmount", str);
		}
		getDao().deleteById(id);
	}
	/**
	 * findDeleteById
	 */
	public TB_User findDeleteById(
		@com.sh_lianjing.annotation.ParameterName("id") @lombok.NonNull Long id
	) throws Exception {
		TB_User bean = getDao().findById(id).get();
		// productOrders
		java.util.List<bairui.international.model.domain.jpa.TB_ProductOrder> productOrders = service_ProductOrder.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!productOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ProductOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ProductOrder item : productOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "productOrders", str);
		}
		// userStateRecords
		java.util.List<bairui.international.model.domain.jpa.TB_UserStateRecord> userStateRecords = service_UserStateRecord.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!userStateRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_UserStateRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_UserStateRecord item : userStateRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "userStateRecords", str);
		}
		// proxyAreaAddresss
		java.util.List<bairui.international.model.domain.jpa.TB_ProxyAreaAddress> proxyAreaAddresss = service_ProxyAreaAddress.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!proxyAreaAddresss.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ProxyAreaAddress.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ProxyAreaAddress item : proxyAreaAddresss){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "proxyAreaAddresss", str);
		}
		// userGradeRecords
		java.util.List<bairui.international.model.domain.jpa.TB_UserGradeRecord> userGradeRecords = service_UserGradeRecord.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!userGradeRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_UserGradeRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_UserGradeRecord item : userGradeRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "userGradeRecords", str);
		}
		// addresss
		java.util.List<bairui.international.model.domain.jpa.TB_Address> addresss = service_Address.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!addresss.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_Address.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_Address item : addresss){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "addresss", str);
		}
		// assignedTickets
		java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicket> assignedTickets = service_ElectronicTicket.page(it->it.assignedUser.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!assignedTickets.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ElectronicTicket.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ElectronicTicket item : assignedTickets){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "assignedTickets", str);
		}
		// electronicTicketPresentedRecords
		java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> electronicTicketPresentedRecords = service_ElectronicTicketPresentRecord.page(it->it.presenteder.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!electronicTicketPresentedRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ElectronicTicketPresentRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord item : electronicTicketPresentedRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "electronicTicketPresentedRecords", str);
		}
		// electronicTicketPresentRecords
		java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord> electronicTicketPresentRecords = service_ElectronicTicketPresentRecord.page(it->it.presenter.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!electronicTicketPresentRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ElectronicTicketPresentRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ElectronicTicketPresentRecord item : electronicTicketPresentRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "electronicTicketPresentRecords", str);
		}
		// takedTickets
		java.util.List<bairui.international.model.domain.jpa.TB_ElectronicTicket> takedTickets = service_ElectronicTicket.page(it->it.takor.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!takedTickets.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ElectronicTicket.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ElectronicTicket item : takedTickets){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "takedTickets", str);
		}
		// userAgentRequestOrders
		java.util.List<bairui.international.model.domain.jpa.TB_UserAgentRequestOrder> userAgentRequestOrders = service_UserAgentRequestOrder.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!userAgentRequestOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_UserAgentRequestOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_UserAgentRequestOrder item : userAgentRequestOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "userAgentRequestOrders", str);
		}
		// winPrizes
		java.util.List<bairui.international.model.domain.jpa.TB_WinPrize> winPrizes = service_WinPrize.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!winPrizes.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_WinPrize.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_WinPrize item : winPrizes){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "winPrizes", str);
		}
		// branchCompanyStaffs
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaff> branchCompanyStaffs = service_BranchCompanyStaff.page(it->it.user.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyStaffs.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaff.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaff item : branchCompanyStaffs){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyStaffs", str);
		}
		// userAmount
		bairui.international.model.domain.jpa.TB_UserAmount userAmount = bean.getUserAmount();
		if(null != userAmount){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_UserAmount.Comment+":[" + userAmount.toString() + "])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "userAmount", str);
		}
		getDao().deleteById(id);
		return bean;
	}
	/**
	 * deleteByIds
	 */
	public void deleteByIds(
		@com.sh_lianjing.annotation.ParameterName("ids") @lombok.NonNull Long ... ids
	) throws Exception {
		deleteByIds(java.util.Arrays.asList(ids));
	}
	
	/**
	 * deleteByIds
	 */
	public void deleteByIds(
		@com.sh_lianjing.annotation.ParameterName("ids") @lombok.NonNull java.util.List<Long> ids
	) throws Exception {
		for(Long id : ids){
			deleteById(id);
		}
	}
		






	/**
	 * getDao()
	 */
	public bairui.international.dao.jpa.Repository_User getDao() {
		return dao;
	}

}
